package thread;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: SEKI TOMOKI
 * Date: 2025-01-13
 * Time: 10:44
 */
public class ThreadDemo7 {
    public static void main(String[] args) {
        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    System.out.println("Hello thread");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        }, "这是我的线程");

        //在 start 之前，设置线程为后台线程 （不能在 start 之后设置）
        t.setDaemon(true);
        t.start();
    }
}
